var tableData = {
	url : ctp + "/contracTemplateController/contracTemplateSearch.shtml",
	propertys : [ "NAME","REC_TIME","REC_UPDATETIME","REC_PERSION"],
	 hrefs:[["function=update","recId=REC_ID","修改",null],["function=contracTemplateDel","recId=REC_ID","删除",null]],
	startLoad : function() {
		getListData(this);
	}
};
function searchData(curr) {
	setTagAndValue("form1", "curr", curr);
	tableData.startLoad();
}
$(document).ready(function() {
	searchData();
});

function contracTemplateDel(recId){
	jconfirm("del('"+recId+"')","是否要删除所选记录？");
}

function del(recIds){
	 $.ajax({ 
		 	url: ctp + "/contracTemplateController/contracTemplateDel.shtml",
		    data: {recIds:recIds},
			type : 'POST',
			async:false, 
			success : function(result) {  
				if(result=="") {  
					jalert9("所选择的记录删除成功！"); 		
					  var curr = "1";
					  if($("#form1").find("#curr").length>0){
						  curr = $("#curr").val();
					  }
					  searchData(curr);
				} 		  
				else{     
					jalert(result);   
				} 
	  		}
		});
}

function update(recId) {
	layui.layer.open({
        type: 2,
        area: ['905px', '550px'],
        title: "合同模板修改",
        fixed: false,
        maxmin: false,
        content: ctp + "/contracTemplateController/contracTemplateUpdate.shtml?recId="+recId
    });
}
function add(){
	layui.layer.open({
        type: 2,
        area: ['1040px', '550px'],
        title: "合同模板新增",
        fixed: false,
        maxmin: false,
        content: ctp + "/contracTemplateController/contracTemplateAdd.shtml"
    });
}
